<?php
/**
 * 货品列表查询参数
 *
 * @author: WangBin
 * @date: 2021/7/26
 * @mail: <849850352@qq.com>
 */
namespace App\Params\Backend;

use App\Params\Param;

class GoodsListParams extends Param
{
    public $goods_bn;
    public $name;
    public $keyword;
    public $category_id;
    public $brand_id;
    public $page_size = 20;
    public $page = 1;

    public function rules()
    {
        return [
            'goods_bn' => 'nullable|string',
            'name' => 'nullable|string',
            'keyword' => 'nullable|string',
            'category_id' => 'nullable|integer|digits_between:1,20',
            'brand_id' => 'nullable|integer|digits_between:1,20',
            'limit' => 'nullable|integer',
            'page' => 'nullable|integer',
        ];
    }

    /**
     * @return mixed
     */
    public function getGoodsBn()
    {
        return $this->goods_bn;
    }

    /**
     * @param mixed $goods_bn
     */
    public function setGoodsBn($goods_bn): void
    {
        $this->goods_bn = $goods_bn;
    }

    /**
     * @return mixed
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * @param mixed $name
     */
    public function setName($name): void
    {
        $this->name = $name;
    }

    /**
     * @return mixed
     */
    public function getKeyword()
    {
        return $this->keyword;
    }

    /**
     * @param mixed $keyword
     */
    public function setKeyword($keyword): void
    {
        $this->keyword = $keyword;
    }

    /**
     * @return mixed
     */
    public function getCategoryId()
    {
        return $this->category_id;
    }

    /**
     * @param mixed $category_id
     */
    public function setCategoryId($category_id): void
    {
        $this->category_id = $category_id;
    }

    /**
     * @return mixed
     */
    public function getBrandId()
    {
        return $this->brand_id;
    }

    /**
     * @param mixed $brand_id
     */
    public function setBrandId($brand_id): void
    {
        $this->brand_id = $brand_id;
    }

    /**
     * @return int
     */
    public function getPageSize(): int
    {
        return $this->page_size;
    }

    /**
     * @param int $page_size
     */
    public function setPageSize(int $page_size): void
    {
        $this->page_size = $page_size;
    }

    /**
     * @return int
     */
    public function getPage(): int
    {
        return $this->page ? -- $this->page : 0;
    }

    /**
     * @param int $page
     */
    public function setPage(int $page): void
    {
        $this->page = $page;
    }
}